<!DOCTYPE html>
<!--
  ~ Copyright (C) 2018 guomw.Inc. All rights reserved.
  ~ 项目名称： mysite
  ~ 文件名称： list.html
  ~ Date：18-10-15 下午3:33
  ~ Author: guomw
  -->

<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/head::head('商品列表')">
<body class="gray-bg">
<style>
    table th {
        text-align: center !important;
    }
</style>
<div class="wrapper wrapper-content  animated fadeInRight">
    <!--search-->
    <form role="form" class="search-panel">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content p-m no-borders">
                        <div class="form-inline">
                            <div class="form-group m-r-sm">
                                <label class="control-label">标题：</label>
                                <input type="text" class="form-control input-sm mb10" id="keyword" name="keyword"
                                       placeholder="模糊搜索"/>
                            </div>
                            <div class="form-group m-r-sm">
                                <label class="control-label">状态：</label>
                                <select id="sl_status" style="height: 34px;" tabindex="2">
                                    <option value="-1">请选择状态</option>
                                    <option value="0">已下架</option>
                                    <option value="1">已上架</option>
                                </select>
                            </div>
                        </div>
                        <p style="height: 8px;"></p>
                        <div class="form-inline" style="max-width: 926px; text-align: right;">
                            <button type="button" class="btn btn-success" onclick="jsHelper.search()">筛选</button>
                            <button type="button" class="btn btn-success" onclick="jsHelper.searchAll()">显示全部</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--search-->
    <!--list-->
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>商品列表</h5>
                    <div class="ibox-tools">
                        <a data-toggle="modal" onclick="jsHelper.edit(0)">
                            <i class="fa fa-plus"></i>
                            添加商品
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <table class="table table-bordered table-hover table-center">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>标题</th>
                            <th>零售价</th>
                            <th>批发价</th>
                            <th>赠送配额</th>
                            <th>零售库存</th>
                            <th>批发总库存</th>
                            <th>是否上架</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="table-content">
                        </tbody>
                    </table>
                    <!--分页控件-->
                    <div th:include="template/pager::pager"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<template id="template_list">
    <tr style="text-align: center;">
        <td>{index}</td>
        <td>{goodsName}</td>
        <td>￥{goodsPrice}</td>
        <td>￥{wholesalePrice}</td>
        <td>{quotaCount}</td>
        <td>{retailStore}</td>
        <td>{totalWholesaleStore}</td>
        <td style="color: red;">{goodsStatus}</td>
        <td>{createTime}</td>
        <td>
            <a type="button" class="btn-a" data-toggle="modal" onclick="jsHelper.edit({goodsId})">修改</a>
            <a type="button" class="btn-a" data-toggle="modal" data-target="#setGoodsStoreCount" onclick="jsHelper.setStoreCount({goodsId})">设置库存</a>
            <a type="button" class="btn-a" data-toggle="modal" onclick="jsHelper.updateStatus({goodsId},{status})">{btnText}</a>
            <a type="button" class="btn-a" data-toggle="modal" onclick="jsHelper.delete({goodsId})">删除</a>
        </td>
    </tr>
</template>
<div class="modal inmodal" id="setGoodsStoreCount" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated flipInY">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span
                        aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title" id="modal-role-title">设置商品库存</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal m-t">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">库存数量：</label>
                        <div class="col-sm-8">
                            <input id="goodsId" name="goodsId" minlength="2" type="hidden" class="form-control" value="0">
                            <input id="storeCount" type="text" class="form-control OnlyFloat" name="storeCount">
                            <span>正整数即表示追加库存，负整数表示减库存</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">备注：</label>
                        <div class="col-sm-8">
                            <input id="remark" type="text" class="form-control" name="remark">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="jsHelper.btnSubmit()">保存</button>
            </div>
        </div>
    </div>
</div>


<footer th:include="common/footer::js"/>
<script src="../../resource/js/views/goodslist.js?v=1.1.7" th:src="@{/resource/js/views/goodslist.js?v=1.1.7}"></script>
</body>
</html>
